package com.ossean.projectmanager.utils;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class DataHandler {

	// 获取当前时间的String
	public static String getNow() {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		String result = sdf.format(new Date());
		return result;
	}

	// 标签分离函数
	public static List<String> tagsSegmentation(String tags) {
		List<String> tag = new ArrayList<String>();

		if (tags != null) {
			String regex = "<[^<>]*>";
			Pattern pattern = Pattern.compile(regex);
			Matcher matcher = pattern.matcher(tags);

			while (matcher.find()) {
				String t = matcher.group();
				t = t.substring(1, t.length() - 1);

				tag.add(t);
			}
		}
		return tag;
	}

}
